﻿Imports Equipment.Business

Public Class EmployeeWorkWrapper
#Region "Properties"

    Public _id As Integer
    Public Property ID As Integer
        Get
            Return _id
        End Get
        Set(ByVal value As Integer)
            _id = value
        End Set
    End Property

    Public _performed As String
    Public Property Performed As String
        Get
            Return _performed
        End Get
        Set(ByVal value As String)
            _performed = value
        End Set
    End Property

    Public _assetID As String
    Public Property AssetID As String
        Get
            Return _assetID
        End Get
        Set(ByVal value As String)
            _assetID = value
        End Set
    End Property

    Public _requirementType As String
    Public Property RequirementType As String
        Get
            Return _requirementType
        End Get
        Set(ByVal value As String)
            _requirementType = value
        End Set
    End Property

#End Region

    Public Shared Function ConvertToWrapperList(ByVal source As IEnumerable(Of Equipment.DataAccess.WorkOrder)) As List(Of EmployeeWorkWrapper)
        Dim wrapperList As New List(Of EmployeeWorkWrapper)

        For Each wo In source
            Dim w As New EmployeeWorkWrapper
            w.ID = wo.ID
            w.Performed = If(wo.PerformedDate.HasValue, wo.PerformedDate.Value.ToString("dd-MMM-yyyy"), String.Empty)
            w.AssetID = wo.Asset.BarcodeID
            w.RequirementType = RequirementTypeLookup.GetDescriptionByType(wo.RequirementType)

            wrapperList.Add(w)
        Next

        Return wrapperList
    End Function
End Class
